package com.example.reggie.config;

import com.example.reggie.interceptor.ReggieInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

@Configuration
public class WebAppConfig extends WebMvcConfig{

    @Bean
    ReggieInterceptor reggieInterceptor(){
        return new ReggieInterceptor();
    }

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {

        String[] patters=new String[]{
                "/employee/login",
                "/employee/logout",
                "/backend/**",
                "/front/**",
                "/user/sendMsg",
                "/user/login"
        };

        registry.addInterceptor(reggieInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(patters);
    }
}
